Skip to main content
Glama
status.ts1.27 kB
import { getProcStatus } from "@/mcp/status/actions/getProcStatus"; import { getMCPLogs } from "@/mcp/status/index"; import { extractMcpName } from "../../utils"; export const singleStatusResponse = async (pathname: string, url: URL) => { // Use extractMcpName to get the mcpName or an error Response const mcpNameResult = extractMcpName(pathname, "status"); // Handle potential Response error from mcpName extraction if (mcpNameResult instanceof Response) { return mcpNameResult; } // If we got here, mcpNameResult is a string const mcpName = mcpNameResult; // Parse ?lines= param if present const linesParam = url.searchParams.get("lines"); const lines = linesParam ? parseInt(linesParam, 10) : 5; let result = await getProcStatus(mcpName); if (!result.success) { return new Response( JSON.stringify({ success: false, error: result.message }) ); } // Destructure to exclude the success property const { success, ...resultData } = result; const logs = await getMCPLogs(mcpName, lines); if (!logs.success) { return new Response(JSON.stringify({ success: false, error: logs.error })); } return new Response( JSON.stringify({ success: true, data: { ...resultData.data, logs }, }) ); };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ashwwwin/furi'

If you have feedback or need assistance with the MCP directory API, please join our Discord server